<template>
    <a-list-layout ref="layout" :params="queryParams" #default="data" request_url="/user/withdrawal_log">
        <view class="record-cell" v-for="(item, index) in data.lists" :item="item" :key="index">
            <view class="remark">
                <text>状态</text>
                <text>{{ { 0: '申请中', 1: '已到账', 2: '提现失败' }[item.status] }}</text>
            </view>
            <view class="remark" v-if="item.status==2">
                <text>拒绝理由</text>
                <text>{{ item.refuse }}</text>
            </view>
            <view class="remark">
                <text>提现金额</text>
                <text :style="{ color: getMoneyColor(item.amount) ? '#333' : '#eb4349' }">{{ item.amount }}</text>
            </view>
            <view class="remark">
                <text>发起提现时间</text>
                <text>{{ item.createtime }}</text>
            </view>
        </view>
    </a-list-layout>
</template>

<script setup>
import { ref, reactive, nextTick } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
/* 上拉加载开始*/
const layout = ref(null);
const queryParams = reactive({
    state: 0 //0已结单1已完成
});
onLoad(async (options) => {
    await nextTick();
    layout.value.getLists();
});
/* 上拉加载结束*/
const getMoneyColor = (money) => {
    console.log('-aaa'.startsWith('-'));
    return money.startsWith('-');
};
</script>

<style lang="scss" scoped>
.record-cell {
    width: 702rpx;
    border-radius: 16rpx;

    margin: 16rpx auto;
    background: #ffffff;
    padding: 24rpx 28rpx 24rpx 40rpx;

    .remark {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20rpx;
        text:nth-child(1) {
            text-align: left;
            font-size: 28rpx;
            color: #9e9e9e;
        }

        text:nth-child(2) {
            color: #3d3d3d;
            font-weight: bold;
            font-size: 28rpx;
        }
    }
}
</style>
